//
//  Lextra_Engine.m
//  Lextra Junior ueb IT
//
//  Created by Dirk Lieder on 26.05.11.
//  Copyright 2011 Phosphon. All rights reserved.
//

#import "Lextra_Engine.h"

#import "SplashscreenViewController.h"
#import "TabbarViewController.h"
#import "NavigationViewController.h"
#import "WoerterViewController.h"
#import "CardViewController.h"
#import "WimmelViewController.h"
#import "WimmelListViewController.h"

#import "ImpressumViewController.h"
#import "SpieleViewController.h"
#import "ThemenViewController.h"

#import "Spiel1ViewController.h"
#import "Spiel2ViewController.h"
#import "Spiel3ViewController.h"
#import "Spiel4ViewController.h"
#import "Spiel5ViewController.h"


@implementation Lextra_Engine



@synthesize splashscreenViewController;
@synthesize tabbarViewController;
@synthesize navigationViewController;
@synthesize woerterViewController;
@synthesize cardViewController;
@synthesize wimmelViewController;
@synthesize wimmelListViewController;
@synthesize impressumViewController;
@synthesize spieleViewController;
@synthesize themenViewController;

@synthesize spiel1ViewController;
@synthesize spiel2ViewController;
@synthesize spiel3ViewController;
@synthesize spiel4ViewController;
@synthesize spiel5ViewController;


static int myStatus;


- (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil
{
    self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil];
    if (self) {
        // Custom initialization
    }
    return self;
}

- (void)dealloc
{
    [super dealloc];
}
- (id)getNavigationID{
    //NSLog(@"--%@", navigationViewController);
    return navigationViewController;
}


- (void)didReceiveMemoryWarning
{
    // Releases the view if it doesn't have a superview.
    [super didReceiveMemoryWarning];
    
    // Release any cached data, images, etc that aren't in use.
}

#pragma mark - View lifecycle


// Implement viewDidLoad to do additional setup after loading the view, typically from a nib.
- (void)viewDidLoad
{   //NSLog(@"Hiii1:%d  * ",1);
	
	// insert NavigationBar
	NavigationViewController *navBar = [[NavigationViewController alloc] initWithNibName:@"NavigationViewController" bundle:nil];
	self.navigationViewController = navBar;
	self.navigationViewController.view.alpha = 0;
	navBar.view.frame = CGRectMake(0, 0, navBar.view.frame.size.width, navBar.view.frame.size.height);
	[self.view addSubview:navBar.view];
	[navBar setDelegate:self];
	[navBar release];
    
    // insert TabBar
	TabbarViewController *tabBar = [[TabbarViewController alloc] initWithNibName:@"TabbarViewController" bundle:nil];
	self.tabbarViewController = tabBar;
	self.tabbarViewController.view.alpha = 0;
	tabBar.view.frame = CGRectMake(0, 480-49, tabBar.view.frame.size.width, tabBar.view.frame.size.height);
	[self.view addSubview:tabBar.view];
	[tabBar release];
	[tabBar setDelegate:self];
    
	// show splash page
	myStatus = 0;
	[self goScreen:1 theName:@"" thePara:nil deliteView:0];
    [super viewDidLoad];
}


- (void)goScreen:(NSInteger)theScreen theName:(NSString*)theName thePara:(NSArray*)thePara deliteView:(BOOL)deliteView{
	
	//NSLog(@"Hiii1:%d  *  %d",theScreen,myStatus);
	
	if(myStatus != theScreen){
		NSLog(@"del View : %d",deliteView);	
        // view/hide navbar & tabbar
        if(theScreen == 1){
                [UIView beginAnimations:nil context:NULL];
                [UIView setAnimationDuration:1.00];
                self.tabbarViewController.view.alpha = 0;
                self.navigationViewController.view.alpha = 0;
                [UIView commitAnimations];
        }else{
            if(myStatus == 1){
                
                [self.tabbarViewController setStatus:1];

                [UIView beginAnimations:nil context:NULL];
                [UIView setAnimationDuration:1.00];
                self.tabbarViewController.view.alpha = 1;
                self.navigationViewController.view.alpha = 1;
                [UIView commitAnimations];
            }
        }
        

        Boolean same = false;
        
        same = theScreen == myStatus;
        same = same || (theScreen == 2 && (myStatus == 10 || myStatus == 11 || myStatus == 12));
        same = same || (theScreen == 3 && (myStatus == 21 || myStatus == 22));
        same = same || (theScreen == 4 && (myStatus == 31 || myStatus == 32 || myStatus == 33|| myStatus == 34|| myStatus == 35));
       
        if(!same){
        
        switch(theScreen){
                
            case 1: 
                
                if(self.splashscreenViewController == nil){
                    SplashscreenViewController *home = [[SplashscreenViewController alloc] initWithNibName:@"SplashscreenViewController" bundle:nil];
                    self.splashscreenViewController = home;
                    [self.view insertSubview:home.view belowSubview:self.navigationViewController.view];
                    [home setDelegate:self];
                    [home release];
                } else{ 
                    [self.view insertSubview:self.splashscreenViewController.view belowSubview:self.navigationViewController.view];
                }	
                 
                break;
                
            case 2: 
                [self.navigationViewController showNavigationText:@"Wörter" deliteView:true];

                if(self.woerterViewController == nil){
                    WoerterViewController *home = [[WoerterViewController alloc] initWithNibName:@"WoerterViewController" bundle:nil];
                    self.woerterViewController = home;
                    
                    CGAffineTransform transform = CGAffineTransformMakeTranslation(0.0, 44.0);
                    [[home view] setTransform:transform];
                    
                    [self.view insertSubview:home.view belowSubview:self.navigationViewController.view];
                    [home setDelegate:self];
                    [home release];
                } else{ 
                    [self.view insertSubview:self.woerterViewController.view belowSubview:self.navigationViewController.view];
                    [self.woerterViewController aktDisplay];
                }
                break;
                
            case 3: 
                //[self.navigationViewController showNavigationText:@"Themen" deliteView:true];
                if(self.themenViewController == nil){
                    ThemenViewController *home = [[ThemenViewController alloc] initWithNibName:@"ThemenViewController" bundle:nil];
                    self.themenViewController = home;
                    
                    CGAffineTransform transform = CGAffineTransformMakeTranslation(0.0, 44.0);
                    [[home view] setTransform:transform];
                    
                    [self.view insertSubview:home.view belowSubview:self.navigationViewController.view];
                    [home setDelegate:self];
                    [home release];
                    
                } else{ 
                    [self.view insertSubview:self.themenViewController.view belowSubview:self.navigationViewController.view];
                    [self.themenViewController aktDisplay];                   
                }
                break;
                
                
            case 4: 
                [self.navigationViewController showNavigationText:@"Spiele" deliteView:true];
                if(self.spieleViewController == nil){
                    SpieleViewController *home = [[SpieleViewController alloc] initWithNibName:@"SpieleViewController" bundle:nil];
                    self.spieleViewController = home;
                    
                    CGAffineTransform transform = CGAffineTransformMakeTranslation(0.0, 44.0);
                    [[home view] setTransform:transform];
                    
                    [self.view insertSubview:home.view belowSubview:self.navigationViewController.view];
                    [home setDelegate:self];
                    [home release];
                    
                } else{ 
                    [self.view insertSubview:self.spieleViewController.view belowSubview:self.navigationViewController.view];
                    [self.spieleViewController aktDisplay];                   
                }
                
                break;

            case 5: 
                [self.navigationViewController showNavigationText:@"Impressum" deliteView:true];
                if(self.impressumViewController == nil){
                    ImpressumViewController *home = [[ImpressumViewController alloc] initWithNibName:@"ImpressumViewController" bundle:nil];
                    self.impressumViewController = home;
                    
                    CGAffineTransform transform = CGAffineTransformMakeTranslation(0.0, 44.0);
                    [[home view] setTransform:transform];
                    
                    [self.view insertSubview:home.view belowSubview:self.navigationViewController.view];
                    [home setDelegate:self];
                    [home release];
                    
                } else{ 
                    [self.view insertSubview:self.impressumViewController.view belowSubview:self.navigationViewController.view];
                    [self.impressumViewController aktDisplay];
                }
                
                break;
               
                
            case 10: 
                
                if(self.cardViewController == nil){
                    CardViewController *home = [[CardViewController alloc] initWithNibName:@"CardViewController" bundle:nil];
                    self.cardViewController = home;
                    
                    CGAffineTransform transform = CGAffineTransformMakeTranslation(0.0, 44.0);
                    [[home view] setTransform:transform];
                    
                    [self.view insertSubview:home.view belowSubview:self.navigationViewController.view];
                    
                    [home release];
                } else{ 
                    [self.view insertSubview:self.cardViewController.view belowSubview:self.navigationViewController.view];
                }
                [self.cardViewController setDelegatePlud:self para:thePara];
                
                
                NSMutableString *tmpString2 = [[NSMutableString alloc] initWithString:[(NSDictionary*) thePara objectForKey:@"origDE"]];
                if([tmpString2 length] == 0){
                    
                    [tmpString2 release];
                    tmpString2 = [[NSMutableString alloc] initWithString:[(NSDictionary*)thePara objectForKey:@"bezeichnungFR"]];
                }
                NSMutableString *tmpString3 = [[NSMutableString alloc] initWithFormat:@"%@%@",[[tmpString2 substringWithRange:NSMakeRange(0, 1)] uppercaseString],[[tmpString2 substringWithRange:NSMakeRange(0, 1)] lowercaseString]];
                [tmpString2 release];
                
                [navigationViewController showNavigationText:tmpString3 deliteView:false];
                
                [tmpString3 release];
                self.cardViewController.view.alpha = 0;
                [UIView beginAnimations:nil context:NULL];
                [UIView setAnimationDuration:1.0];
                self.cardViewController.view.alpha = 1;
                [UIView commitAnimations];

                
                
                break;
                
            case 11: 
            case 21: 
                
                if(self.wimmelViewController == nil){
                    WimmelViewController *home = [[WimmelViewController alloc] initWithNibName:@"WimmelViewController" bundle:nil];
                    self.wimmelViewController = home;
                    
                    CGAffineTransform transform = CGAffineTransformMakeTranslation(0.0, 44.0);
                    [[home view] setTransform:transform];
                    
                    [self.view insertSubview:home.view belowSubview:self.navigationViewController.view];
                    
                    [home release];
                } else{ 
                    [self.view insertSubview:self.wimmelViewController.view belowSubview:self.navigationViewController.view];
                }
                [self.wimmelViewController setDelegatePlud:self para:thePara bIsParentThemmen:YES];
                
                //[self.navigationViewController showNavigationText:@"test" deliteView:false];
                //[navigationViewController showNavigationText:@"Cc" deliteView:false];
                //NSMutableString *tmpString3 = [[NSMutableString alloc] initWithString:[tmpString2 substringWithRange:NSMakeRange(0, 2)]];
               
                NSMutableString *tmpString5;
                tmpString5 = [[NSMutableString alloc] initWithFormat:@"%@%@",[[[(NSDictionary*)thePara objectForKey:@"bezeichnungFR"] substringWithRange:NSMakeRange(0, 1)] uppercaseString],[[[(NSDictionary*)thePara objectForKey:@"bezeichnungFR"] substringWithRange:NSMakeRange(0, 1)] lowercaseString]];
                
                if(theScreen==21) {
                    [tmpString5 release];
                    tmpString5 = [[NSMutableString alloc] initWithFormat:@"%@", [(NSDictionary*)thePara objectForKey:@"artikel"]];
                    
                    if([tmpString5 length] > 0){
                        if(![tmpString5 hasSuffix:@"'"]){
                            [tmpString5 appendString:@" "];
                        }
                    }
                    
                    if([[(NSDictionary*)thePara objectForKey:@"origFR"] length] !=0){
                        [tmpString5 appendString:[(NSDictionary*)thePara objectForKey:@"origFR"]]; 
                    } else {
                        [tmpString5 appendString:[(NSDictionary*)thePara objectForKey:@"bezeichnungFR"]]; 
                    }
                    
                } //tmpString5 = [[NSMutableString alloc] initWithString:[thePara objectForKey:@"bezeichnungFR"]];

                [navigationViewController showNavigationText:tmpString5 deliteView:false];
                [tmpString5 release];
                            
                self.wimmelViewController.view.alpha = 0;
                [UIView beginAnimations:nil context:NULL];
                [UIView setAnimationDuration:1.0];
                self.wimmelViewController.view.alpha = 1;
                [UIView commitAnimations];
                
                break;
                
        
                
            case 12: 
            case 22: 
                
                if(self.wimmelListViewController == nil){
                    WimmelListViewController *home = [[WimmelListViewController alloc] initWithNibName:@"WimmelListViewController" bundle:nil];
                    self.wimmelListViewController = home;
                    
                    CGAffineTransform transform = CGAffineTransformMakeTranslation(0.0, 44.0);
                    [[home view] setTransform:transform];
                    
                    [self.view insertSubview:home.view belowSubview:self.navigationViewController.view];
                    
                    [home release];
                } else{ 
                    [self.view insertSubview:self.wimmelListViewController.view belowSubview:self.navigationViewController.view];
                }
                [self.wimmelListViewController setDelegatePlud:self para:thePara ];
                
                NSMutableString *tmpString6;   

                tmpString6 = [[NSMutableString alloc] initWithFormat:@"%@%@",[[[(NSDictionary*)thePara objectForKey:@"bezeichnungFR"] substringWithRange:NSMakeRange(0, 1)] uppercaseString],[[[(NSDictionary*)thePara objectForKey:@"bezeichnungFR"] substringWithRange:NSMakeRange(0, 1)] lowercaseString]];
                
                if(theScreen==22) {
                    
                    [tmpString6 release];
                    tmpString6 = [[NSMutableString alloc] initWithFormat:@"%@", [(NSDictionary*)thePara objectForKey:@"artikel"]];
                    
                    if([tmpString6 length] > 0){
                        if(![tmpString6 hasSuffix:@"'"]){
                            [tmpString6 appendString:@" "];
                        }
                    }
                    
                    if([[(NSDictionary*)thePara objectForKey:@"origFR"] length] !=0){
                        [tmpString6 appendString:[(NSDictionary*)thePara objectForKey:@"origFR"]]; 
                    } else {
                        [tmpString6 appendString:[(NSDictionary*)thePara objectForKey:@"bezeichnungFR"]]; 
                    }
                    
                } //tmpString5 = [[NSMutableString alloc] initWithString:[thePara objectForKey:@"bezeichnungFR"]];

                
                [navigationViewController showNavigationText:tmpString6 deliteView:false];
                [tmpString6 release];
                
                self.wimmelListViewController.view.alpha = 0;
                [UIView beginAnimations:nil context:NULL];
                [UIView setAnimationDuration:1.0];
                self.wimmelListViewController.view.alpha = 1;
                [UIView commitAnimations];
                
                break;
                
              
            case 31: 
                
                if(self.spiel1ViewController == nil){
                    Spiel1ViewController *home = [[Spiel1ViewController alloc] initWithNibName:@"Spiel1ViewController" bundle:nil];
                    self.spiel1ViewController = home;
                    
                    CGAffineTransform transform = CGAffineTransformMakeTranslation(0.0, 44.0);
                    [[home view] setTransform:transform];
                    
                    [self.view insertSubview:home.view belowSubview:self.navigationViewController.view];
                    
                    [home release];
                } else{ 
                    [self.view insertSubview:self.spiel1ViewController.view belowSubview:self.navigationViewController.view];
                }
                [self.spiel1ViewController setDelegatePlud:self];
                
                
                [navigationViewController showNavigationText:@"Hör mal!" deliteView:false];
                
                self.spiel1ViewController.view.alpha = 0;
                [UIView beginAnimations:nil context:NULL];
                [UIView setAnimationDuration:1.0];
                self.spiel1ViewController.view.alpha = 1;
                [UIView commitAnimations];
                
                
                break;

            case 32: 
                
                if(self.spiel2ViewController == nil){
                    Spiel2ViewController *home = [[Spiel2ViewController alloc] initWithNibName:@"Spiel2ViewController" bundle:nil];
                    self.spiel2ViewController = home;
                    
                    CGAffineTransform transform = CGAffineTransformMakeTranslation(0.0, 44.0);
                    [[home view] setTransform:transform];
                    
                    [self.view insertSubview:home.view belowSubview:self.navigationViewController.view];
                    
                    [home release];
                } else{ 
                    [self.view insertSubview:self.spiel2ViewController.view belowSubview:self.navigationViewController.view];
                }
                [self.spiel2ViewController setDelegatePlud:self];
                
                
                [navigationViewController showNavigationText:@"Wortsammler" deliteView:false];
                
                self.spiel2ViewController.view.alpha = 0;
                [UIView beginAnimations:nil context:NULL];
                [UIView setAnimationDuration:1.0];
                self.spiel2ViewController.view.alpha = 1;
                [UIView commitAnimations];
                
                
                break;

            case 33: 
                
                if(self.spiel3ViewController == nil){
                    Spiel3ViewController *home = [[Spiel3ViewController alloc] initWithNibName:@"Spiel3ViewController" bundle:nil];
                    self.spiel3ViewController = home;
                    
                    CGAffineTransform transform = CGAffineTransformMakeTranslation(0.0, 44.0);
                    [[home view] setTransform:transform];
                    
                    [self.view insertSubview:home.view belowSubview:self.navigationViewController.view];
                    
                    [home release];
                } else{ 
                    [self.view insertSubview:self.spiel3ViewController.view belowSubview:self.navigationViewController.view];
                }
                [self.spiel3ViewController setDelegatePlud:self];
                
                
                [navigationViewController showNavigationText:@"Vokabeltrainer" deliteView:false];
                
                self.spiel3ViewController.view.alpha = 0;
                [UIView beginAnimations:nil context:NULL];
                [UIView setAnimationDuration:1.0];
                self.spiel3ViewController.view.alpha = 1;
                [UIView commitAnimations];
                
                
                break;

            case 34: 
                [navigationViewController showNavigationText:@"Sprach-Memo" deliteView:false];
                
                if(self.spiel4ViewController == nil){
                    Spiel4ViewController *home = [[Spiel4ViewController alloc] initWithNibName:@"Spiel4ViewController" bundle:nil];
                    self.spiel4ViewController = home;
                    
                    CGAffineTransform transform = CGAffineTransformMakeTranslation(0.0, 44.0);
                    [[home view] setTransform:transform];
                    
                    [self.view insertSubview:home.view belowSubview:self.navigationViewController.view];
                    
                    [home release];
                } else{ 
                    [self.view insertSubview:self.spiel4ViewController.view belowSubview:self.navigationViewController.view];
                }
                [self.spiel4ViewController setDelegatePlud:self];
                
                
                
                self.spiel4ViewController.view.alpha = 0;
                [UIView beginAnimations:nil context:NULL];
                [UIView setAnimationDuration:1.0];
                self.spiel4ViewController.view.alpha = 1;
                [UIView commitAnimations];
                
                
                break;

            case 35: 
                [navigationViewController showNavigationText:@"Schnellübersetzer" deliteView:false];

                if(self.spiel5ViewController == nil){
                    Spiel5ViewController *home = [[Spiel5ViewController alloc] initWithNibName:@"Spiel5ViewController" bundle:nil];
                    self.spiel5ViewController = home;
                    
                    CGAffineTransform transform = CGAffineTransformMakeTranslation(0.0, 44.0);
                    [[home view] setTransform:transform];
                    
                    [self.view insertSubview:home.view belowSubview:self.navigationViewController.view];
                    
                    [home release];
                } else{ 
                    [self.view insertSubview:self.spiel5ViewController.view belowSubview:self.navigationViewController.view];
                }
                [self.spiel5ViewController setDelegatePlud:self];
                
                
                
                self.spiel5ViewController.view.alpha = 0;
                [UIView beginAnimations:nil context:NULL];
                [UIView setAnimationDuration:1.0];
                self.spiel5ViewController.view.alpha = 1;
                [UIView commitAnimations];
                
                
                break;

        }
            
            // remove old Screen in step#2
            if(deliteView){
                switch(myStatus){
                        
                    case 1: 
                        // remove splash page
                        if(self.splashscreenViewController) [self.splashscreenViewController.view removeFromSuperview];
                        break;     
                        
                    case 2:
                        if(self.woerterViewController) [self.woerterViewController.view removeFromSuperview];
                        break;   

                    case 3:
                        if(self.themenViewController) [self.themenViewController.view removeFromSuperview];
                        break;   
 
                    case 4:
                        if(self.spieleViewController) [self.spieleViewController.view removeFromSuperview];
                        break;   

                    case 5:
                        if(self.impressumViewController) [self.impressumViewController.view removeFromSuperview];
                        break;   
                    
                    case 10:
                        if(self.cardViewController) {
                            [self.cardViewController sstop];
                            [self.cardViewController.view removeFromSuperview];
                        }
                        if(self.woerterViewController) [self.woerterViewController.view removeFromSuperview];
                        break;  
                        
                    case 11:
                        if(self.wimmelViewController) {
                            [self.wimmelViewController sstop];
                            [self.wimmelViewController.view removeFromSuperview];
                        }
                        if(self.woerterViewController) [self.woerterViewController.view removeFromSuperview];
                        break;  
                        
                    case 12:
                        if(self.wimmelListViewController) {
                            [self.wimmelListViewController sstop];
                            [self.wimmelListViewController.view removeFromSuperview];
                        }
                        if(self.woerterViewController) [self.woerterViewController.view removeFromSuperview];
                        break;   
 
                    
                    case 21:
                        if(self.wimmelViewController) {
                            [self.wimmelViewController sstop];
                            [self.wimmelViewController.view removeFromSuperview];
                        }
                        if(self.themenViewController) [self.themenViewController.view removeFromSuperview];
                        break;   
                    case 22:
                        if(self.wimmelListViewController) {
                            [self.wimmelListViewController sstop];
                            [self.wimmelListViewController.view removeFromSuperview];
                        }
                        if(self.themenViewController) [self.themenViewController.view removeFromSuperview];
                        break;   
                        
                    case 31:
                        if(self.spiel1ViewController) {
                            [self.spiel1ViewController sstop];
                            [self.spiel1ViewController.view removeFromSuperview];
                        }
                        if(self.spieleViewController) [self.spieleViewController.view removeFromSuperview];
                        break;  
                        
                    case 32:
                        if(self.spiel2ViewController) {
                            [self.spiel2ViewController sstop];
                            [self.spiel2ViewController.view removeFromSuperview];
                        }
                        if(self.spieleViewController) [self.spieleViewController.view removeFromSuperview];
                        break;  
                        
                    case 33:
                        if(self.spiel3ViewController) {
                            [self.spiel3ViewController sstop];
                            [self.spiel3ViewController.view removeFromSuperview];
                        }
                        if(self.spieleViewController) [self.spieleViewController.view removeFromSuperview];
                        break;  
                        
                    case 34:
                        if(self.spiel4ViewController) {
                            [self.spiel4ViewController sstop];
                            [self.spiel4ViewController.view removeFromSuperview];
                        }
                        if(self.spieleViewController) [self.spieleViewController.view removeFromSuperview];
                        break; 
                        
                   case 35:
                        if(self.spiel5ViewController) {
                            [self.spiel5ViewController sstop];
                            [self.spiel5ViewController.view removeFromSuperview];
                        }
                        if(self.spieleViewController) [self.spieleViewController.view removeFromSuperview];
                        break;  
                     
                }
            }
           
            
            
        } else {
            [self closeNavigation];
            [self.navigationViewController backText];
            //[self.woerterViewController aktDisplay];
        }
                
        myStatus = theScreen;
	}
}


- (void)jmpTo:(NSString*)typ name:(NSString*)name thePara:(NSArray*)thePara{
    
	if([typ isEqualToString:@"card"]){
	
        [self goScreen:10 theName:name thePara:thePara deliteView:0];

    } else if([typ isEqualToString:@"wimmel"]){
        
        // wimmel oder wimmellist
        if(myStatus == 2){
            if([[(NSDictionary*)thePara objectForKey:@"wimmelbild"] hasPrefix:@"*"]){
                if([[(NSDictionary*)thePara objectForKey:@"wimmelnummer"] intValue] ==0){
                    [self goScreen:12 theName:name thePara:thePara deliteView:0];
                } else {
                    [self goScreen:10 theName:name thePara:thePara deliteView:0];
                }
            } else {
                [self goScreen:11 theName:name thePara:thePara deliteView:0];
            }

        } else {
            if([[(NSDictionary*)thePara objectForKey:@"wimmelbild"] hasPrefix:@"*"]){
                [self goScreen:22 theName:name thePara:thePara deliteView:0];
            } else {
                [self goScreen:21 theName:name thePara:thePara deliteView:0];
            }
        }
        
    }
}


- (void) closeNavigation{
	//NSLog(@"Hiii1:%d  *  %d",myStatus,myOldStatus);
	if(myStatus== 10){ 
        
		[self.cardViewController sstop];
        [UIView beginAnimations:nil context:NULL];
		[UIView setAnimationDuration:1.0];
		self.cardViewController.view.alpha = 0;
		[UIView commitAnimations];
        
        myStatus = 2;
        
	}
    if(myStatus== 11){ 
        
		[self.wimmelViewController sstop];
        [UIView beginAnimations:nil context:NULL];
		[UIView setAnimationDuration:1.0];
		self.wimmelViewController.view.alpha = 0;
		[UIView commitAnimations];
        
        myStatus = 2;
	}
    if(myStatus== 12){ 
        
		[self.wimmelListViewController sstop];
        [UIView beginAnimations:nil context:NULL];
		[UIView setAnimationDuration:1.0];
		self.wimmelListViewController.view.alpha = 0;
		[UIView commitAnimations];
        
        myStatus = 2;
	}
    if(myStatus== 21){ 
        
		[self.wimmelViewController sstop];
        [UIView beginAnimations:nil context:NULL];
		[UIView setAnimationDuration:1.0];
		self.wimmelViewController.view.alpha = 0;
		[UIView commitAnimations];
        
        myStatus = 3;
	}
    if(myStatus== 22){ 
        
		[self.wimmelListViewController sstop];
        [UIView beginAnimations:nil context:NULL];
		[UIView setAnimationDuration:1.0];
		self.wimmelListViewController.view.alpha = 0;
		[UIView commitAnimations];
        
        myStatus = 3;
	}
    if(myStatus== 31){ 
        
		[self.spiel1ViewController sstop];
        [UIView beginAnimations:nil context:NULL];
		[UIView setAnimationDuration:1.0];
		self.spiel1ViewController.view.alpha = 0;
		[UIView commitAnimations];
        
        myStatus = 4;
	}
    if(myStatus== 32){ 
        
		[self.spiel2ViewController sstop];
        [UIView beginAnimations:nil context:NULL];
		[UIView setAnimationDuration:1.0];
		self.spiel2ViewController.view.alpha = 0;
		[UIView commitAnimations];
        
        myStatus = 4;
	}
    if(myStatus== 33){ 
        
		[self.spiel3ViewController sstop];
        [UIView beginAnimations:nil context:NULL];
		[UIView setAnimationDuration:1.0];
		self.spiel3ViewController.view.alpha = 0;
		[UIView commitAnimations];
        
        myStatus = 4;
	}
    if(myStatus== 34){ 
        
		[self.spiel4ViewController sstop];
        [UIView beginAnimations:nil context:NULL];
		[UIView setAnimationDuration:1.0];
		self.spiel4ViewController.view.alpha = 0;
		[UIView commitAnimations];
        
        myStatus = 4;
	}
    if(myStatus== 35){ 
        
		[self.spiel5ViewController sstop];
        [UIView beginAnimations:nil context:NULL];
		[UIView setAnimationDuration:1.0];
		self.spiel5ViewController.view.alpha = 0;
		[UIView commitAnimations];
        
        myStatus = 4;
	}

}


- (NSDictionary*) getPoindInfo:(NSString*)myBild num:(NSInteger)num {
    return([woerterViewController getPoindInfo:myBild num:num]);
}

- (NSArray*) getWimmelListPoinds:(NSString*)myBild{
    return([woerterViewController getWimmelListPoinds:myBild]);
}
- (NSMutableArray*) getGameListPoinds{
    return([woerterViewController getGameListPoinds]);
}
- (NSMutableArray*) getGameListSchnell{
    return([woerterViewController getGameListSchnell]);
}



- (void)viewDidUnload
{
    [super viewDidUnload];
    // Release any retained subviews of the main view.
    // e.g. self.myOutlet = nil;
}

- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation
{
    // Return YES for supported orientations
    return (interfaceOrientation == UIInterfaceOrientationPortrait);
}

@end
